home *** CD-ROM | disk | FTP | other *** search
- #include "Packages.h"
- #include "PBDefs.h"
- #include "OSIo.h"
-
- Make_Name(vol,srcname,dstname)
- short vol;
- char *srcname,*dstname;
- { char i;
- VolumeParam pb;
- pb.ioCompletion = 0;
- pb.ioVRefNum = vol;
- pb.ioVolIndex = 0;
- pb.ioNamePtr = dstname;
- PBGetVInfo(&pb,0);
- i=dstname[0]+1;
- dstname[i]=':';
- BlockMove(&srcname[1],&dstname[i+1],srcname[0]);
- dstname[0]=i+srcname[0];
- PtoCstr(dstname);
- return(vol);
- }
-
- MakeName(r,name)
- SFReply *r;
- char *name;
- { return(Make_Name(r->vRefNum,&r->Namelength,name));
- }
-
- SFGetFile(loc,prompt,filter,num,typelist,dlghook,reply)
- long loc,filter,dlghook;
- short num;
- char *reply,*prompt,*typelist;
- { long oldport;
- GetPort(&oldport);
- #asm
- MOVE.L D0,-(SP) ;location
- MOVE.L D1,-(SP) ;Prompt
- MOVE.L D2,-(SP) ;FileFilter
- MOVE.W D3,-(SP) ;numTypes
- MOVE.L D4,-(SP) ;TypeList
- MOVE.L D5,-(SP) ;DlgHook
- MOVE.L D6,-(SP) ;Reply
- MOVE.W #2,-(SP) ;routine selector for GetFile
- DC.W $A9EA ;Pack3
- #endasm
- SetPort(oldport);
- return(reply[0]);
- }
-
- SFPutFile(loc,prompt,oldname,dlghook,reply)
- long loc,dlghook;
- char *prompt,*oldname,*reply;
- { long oldport;
- GetPort(&oldport);
- #asm
- MOVE.L D0,-(SP) ;location
- MOVE.L D1,-(SP) ;Prompt
- MOVE.L D2,-(SP) ;OrigName
- MOVE.L D3,-(SP) ;DlgHook
- MOVE.L D4,-(SP) ;Reply
- MOVE.W #1,-(SP) ;routine selector for PutFile
- DC.W $A9EA ;Pack3
- #endasm
- SetPort(oldport);
- return(reply[0]);
- }
-
- OldFileName(count,types,reply)
- short count;
- char *types,*reply;
- { return(SFGetFile(0x00500050,0,0,count,types,0,reply));
- }
-
- NewFileName(name,reply)
- char *name,*reply;
- { return(SFPutFile(0x00500050,"\010Save as:",name,0,reply));
- }
-